package com.sayyi.validate.constraints.custom;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.Documented;
import java.lang.annotation.Repeatable;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
 * @author xuchuang
 * date 2021/12/7 2:35 PM
 */
@Target({FIELD})
@Retention(RUNTIME)
@Constraint(validatedBy = {NotExistValidator.class})
@Documented
@Repeatable(NotExist.List.class)
public @interface NotExist {

    String value();

    String message() default "数据不存在于指定集合中";

    Class<?>[] groups() default { };

    Class<? extends Payload>[] payload() default { };

    @Target({ FIELD})
    @Retention(RUNTIME)
    @Documented
    @interface List {
        NotExist[] value();
    }
}
